﻿using System;
using Newtonsoft.Json.Linq;
using JsonCSharpClassGenerator;

namespace MyVideoTek
{

    internal class Statistics
    {

        private JObject __jobject;
        public Statistics(JObject obj)
        {
            this.__jobject = obj;
        }

        public double PressRating
        {
            get
            {
                return JsonClassHelper.ReadFloat(JsonClassHelper.GetJToken<JValue>(__jobject, "pressRating"));
            }
        }

        public int PressReviewCount
        {
            get
            {
                return JsonClassHelper.ReadInteger(JsonClassHelper.GetJToken<JValue>(__jobject, "pressReviewCount"));
            }
        }

        public double UserRating
        {
            get
            {
                return JsonClassHelper.ReadFloat(JsonClassHelper.GetJToken<JValue>(__jobject, "userRating"));
            }
        }

        public int UserReviewCount
        {
            get
            {
                return JsonClassHelper.ReadInteger(JsonClassHelper.GetJToken<JValue>(__jobject, "userReviewCount"));
            }
        }

        public int UserNoteCount
        {
            get
            {
                return JsonClassHelper.ReadInteger(JsonClassHelper.GetJToken<JValue>(__jobject, "userNoteCount"));
            }
        }

        public int CommentCount
        {
            get
            {
                return JsonClassHelper.ReadInteger(JsonClassHelper.GetJToken<JValue>(__jobject, "commentCount"));
            }
        }

        [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
        private RatingStats _ratingStats;
        public RatingStats RatingStats
        {
            get
            {
                if(_ratingStats == null)
                    _ratingStats = JsonClassHelper.ReadStronglyTypedObject<RatingStats>(JsonClassHelper.GetJToken<JObject>(__jobject, "ratingStats"));
                return _ratingStats;
            }
        }

        public int FanCount
        {
            get
            {
                return JsonClassHelper.ReadInteger(JsonClassHelper.GetJToken<JValue>(__jobject, "fanCount"));
            }
        }

        public int TheaterCountOnRelease
        {
            get
            {
                return JsonClassHelper.ReadInteger(JsonClassHelper.GetJToken<JValue>(__jobject, "theaterCountOnRelease"));
            }
        }

        public int ReleaseWeekPosition
        {
            get
            {
                return JsonClassHelper.ReadInteger(JsonClassHelper.GetJToken<JValue>(__jobject, "releaseWeekPosition"));
            }
        }

    }
}
